Pull Request: Delegated Voting Rights Transfer within Vault (#105, #52)#156
Merged
JerryIdoko merged 2 commits intoVesting-Vault:mainfrom Mar 23, 2026
Conversation
|
@elizabetheonoja-art Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
c98e8f2 to
accc5bc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
This PR introduces a Delegated Voting mechanism to the Vesting Vault. It allows beneficiaries to decouple their economic interest (the locked tokens) from their governance power (the voting rights).
By implementing delegate_voting_power, users can empower a representative to vote on their behalf in associated DAOs without requiring the tokens to be unlocked or moved, maintaining the integrity of the vesting schedule.
🎯 Key Changes
Storage Mapping: Created a persistent Mapping<Address, Address> (Beneficiary -> Representative) to track delegations.
Delegation Logic: Added the delegate_voting_power(e: Env, representative: Address) function with signature verification for the beneficiary.
DAO Integration Hook: Added a get_voting_power(e: Env, address: Address) helper. This function checks if any beneficiaries have delegated to the queried address and returns the cumulative balance.
Event Emission: Added a DelegateChanged event to allow off-chain indexers to track governance shifts in real-time.
💻 Implementation Logic
The core logic ensures that the representative is credited with the voting weight while the beneficiary retains ownership of the underlying assets:
Rust
pub fn delegate_voting_power(e: Env, beneficiary: Address, representative: Address) {
beneficiary.require_auth();
}
✅ Acceptance Criteria Checklist
[x] Mapping Implementation: Successfully stores and retrieves Representative addresses.
[x] Query Logic: The vault correctly reports cumulative balances to representatives when queried by DAO contracts.
[x] Security: Only the beneficiary can change their own delegate.
[x] Standard Alignment: Follows industry standards for non-custodial voting delegation.
🚀 How to Verify
Test Delegation: Call delegate_voting_power from Account A to Account B.
Verify Weight: Call get_voting_power for Account B; it should reflect Account A’s locked balance.
Run Suite: cargo test to ensure no regressions in the core vesting logic.
🔗 Linked Issues
Closes #105
Closes #52